package round91;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class C {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String split[] = in.readLine().split(" ");
        int l = Integer.parseInt(split[0]);
        int r = Integer.parseInt(split[1]);

        long sum = 0, num, d = (((int) Math.log10(l)) + 1), lucky;
        for (long i = (1L << d); ; i++) {
            num = luckyVal(i);
            if (num >= l) {
                lucky = i;
                break;
            }
        }

        for (long i = l; i <= r; ) {
            long cL = luckyVal(lucky);
            long range = Math.min(r, cL) - i + 1;
            sum += range * cL;
            i += range;
            lucky++;
        }

        System.out.println(sum);
    }

    private static long luckyVal(long luck) {
        long num = 0;
        for (int j = (int) (Math.log(Long.highestOneBit(luck)) / Math.log(2)); j > 0; j--) {
            num *= 10;
            num += (luck & (1 << (j - 1))) == 0 ? 4 : 7;
        }
        return num;
    }

    private static long next(long n) {
        int d = (int) Math.log10(n);
        d++;
        if (isLucky(n)) {
            int res = 1 << d;
            int p = 1;
            for (int i = 0; i <= d - 1; i++) {
                res = res | (((n / p) % 10) == 4 ? 0 : (1 << i));
                p *= 10;
            }
            return res;
        }
        long pow = (int) Math.pow(10, d - 1);
        int digit = (int) (n / pow);
        if (digit < 4) {
            return (1L << d);
        } else if (digit > 4) {
            return (1L << d) | (1L << (d - 1));
        } else {
            return (1L << d) | (((1L << (d - 1)) - 1) & next(n % pow));
        }
    }

    private static boolean isLucky(long n) {
        while (n > 0) {
            if (n % 10 == 4 || n % 10 == 7)
                n /= 10;
            else
                return false;
        }
        return true;
    }
}
